package com.zsw.alancomicserver.repository.rowMapper;

import com.zsw.alancomicserver.repository.po.BookItemPO;
import org.springframework.jdbc.core.RowMapper;

import java.sql.ResultSet;
import java.sql.SQLException;

public class BookItemRowMapper implements RowMapper<BookItemPO> {

    @Override
    public BookItemPO mapRow(ResultSet rs, int rowNum) throws SQLException {
        BookItemPO bookItemPO = new BookItemPO();

        bookItemPO.setId(rs.getLong("id"));
        bookItemPO.setBookId(rs.getLong("book_id"));
        bookItemPO.setBookItemId(rs.getLong("book_item_id"));
        bookItemPO.setBookItemTitle(rs.getString("book_item_title"));
        bookItemPO.setBookItemImgs(rs.getString("book_item_imgs"));
        bookItemPO.setCreateTime(rs.getTimestamp("create_time"));
        bookItemPO.setUpdateTime(rs.getTimestamp("update_time"));
        bookItemPO.setContent(rs.getString("content"));
        bookItemPO.setHeadImgUrl(rs.getString("head_img_url"));

        return bookItemPO;
    }
}
